const WxParse = require('../../wxParse/wxParse.js')

Page({
    data: {
        courseList: []
    },
    onLoad() {
        wx.showLoading({
            title: '加载中'
        })

        wx.showShareMenu({
            withShareTicket: true
        })
        
        wx.request({
            url: 'https://www.kelionline.com/api/miniProgram/mnm/courseList',
            method: 'GET',
            success: res => {
                if (res.data.code == 0) {
                    wx.hideLoading()
                    
                    const data = res.data.data

                    for (let i = 0; i < data.length; i++) {
                        WxParse.wxParse('descript[' + i + ']', 'html', data[i].descript, this)
                    }

                    this.setData({
                        courseList: data
                    })
                }
            }
        })
    }
})